package com.tongji.housediy.model
{
	import com.tongji.housediy.utils.ConstVariableInventory;
	import com.tongji.housediy.utils.LoadAdmin;
	import com.tongji.housediy.vo.Model;
	
	import flash.display.BitmapData;
	import flash.display.Loader;
	import flash.events.Event;
	
	/**
	 * 
	 * @author chenchao
	 * 
	 */
	public class FloorModel extends Model
	{
		public function FloorModel()
		{
			super();
		}
		
		public function loadRoomData(dataSrc:String):void
		{
			var loader:Loader = LoadAdmin.loadBitmapData(dataSrc);
			loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadRoomCompleteHandler);
		}
		
		private function loadRoomCompleteHandler(event:Event):void
		{
			event.target.removeEventListener(Event.COMPLETE, loadRoomCompleteHandler);
			ConstVariableInventory.roomBitmapData = event.target.content.bitmapData;
		}
		
		public function loadFloorData(dataSrc:String):void
		{
			var loader:Loader = LoadAdmin.loadBitmapData(dataSrc);
			loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadFloorCompleteHandler);
		}
		
		private function loadFloorCompleteHandler(event:Event):void
		{
			event.target.removeEventListener(Event.COMPLETE, loadFloorCompleteHandler);
			ConstVariableInventory.floorBitmapData = event.target.content.bitmapData;
		}
		
		public function loadWallData(dataSrc:String):void
		{
			var loader:Loader = LoadAdmin.loadBitmapData(dataSrc);
			loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadWallCompleteHandler);
		}
		
		private function loadWallCompleteHandler(event:Event):void
		{
			event.target.removeEventListener(Event.COMPLETE, loadWallCompleteHandler);
			ConstVariableInventory.wallBitmapData = event.target.content.bitmapData;
		}
	}
}